home *** CD-ROM | disk | FTP | other *** search
/ Your Mobile: Alcatel / Alcatel 2005.iso / Alcatel One Touch 715 / data1.cab / Creation_Studio_Data / csGraph.dxr / 00038_bhv toile.ls < prev    next >
Encoding:
Text File  |  2002-06-21  |  5.6 KB  |  139 lines

  1. global gOutilActif, gcouleurActive, gFormeOutil, spr_Buffer, spr_Toile, spr_loupe, gRemplirZone, firstbackup, gIDXformat
  2.  
  3. on beginSprite me
  4.   firstbackup = 1
  5.   sprite(47).member = member("format-" & gIDXformat)
  6.   spr_Toile = me.spriteNum
  7. end
  8.  
  9. on mouseDown me
  10.   if gOutilActif = "outil" then
  11.     doBackUp()
  12.     if gFormeOutil = "pot" then
  13.       rectPreview = sendSprite(spr_loupe, #locrect)
  14.       rapport = float(rectPreview.width) / float(sprite(me.spriteNum).member.width)
  15.       a = rectPreview[1] + ((the mouseH - sprite(me.spriteNum).left) * rapport)
  16.       aprime = string(a)
  17.       a = aprime.char[1..offset(".", aprime)]
  18.       a = value(a)
  19.       b = rectPreview[2] + ((the mouseV - sprite(me.spriteNum).top) * rapport)
  20.       bprime = string(b)
  21.       b = bprime.char[1..offset(".", bprime)]
  22.       b = value(b)
  23.       member("pictSource").image.floodFill(point(a, b), gcouleurActive)
  24.       sendSprite(spr_loupe, #bouge)
  25.       sendSprite(spr_loupe, #repaint)
  26.     else
  27.       oldPoint = 0
  28.       repeat while the mouseDown
  29.         tailleOutil = member(gFormeOutil).rect
  30.         rectPreview = sendSprite(spr_loupe, #locrect)
  31.         rapport = float(rectPreview.width) / float(sprite(me.spriteNum).member.width)
  32.         a = rectPreview[1] + ((the mouseH - sprite(me.spriteNum).left) * rapport) - (tailleOutil.width / 2)
  33.         aprime = string(a)
  34.         a = aprime.char[1..offset(".", aprime)]
  35.         a = value(a)
  36.         b = rectPreview[2] + ((the mouseV - sprite(me.spriteNum).top) * rapport) - (tailleOutil.height / 2)
  37.         bprime = string(b)
  38.         b = bprime.char[1..offset(".", bprime)]
  39.         b = value(b)
  40.         c = a + tailleOutil.width
  41.         d = b + tailleOutil.height
  42.         recep = rect(a, b, c, d)
  43.         if gFormeOutil = "forme_gomme" then
  44.           recep = recep + rect(6, 7, 6, 7)
  45.         end if
  46.         repeat with i = 1 to 4
  47.           recep[i] = integer(recep[i])
  48.         end repeat
  49.         member("pictSource").image.copyPixels(member(gFormeOutil).image, recep, member(gFormeOutil).rect, [#ink: 36, #color: gcouleurActive])
  50.         if gFormeOutil = "forme_crayon" then
  51.           if oldPoint <> 0 then
  52.             coordline = rect(oldPoint.left, oldPoint.top, recep.right, recep.bottom)
  53.             member("pictSource").image.draw(coordline, [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
  54.           end if
  55.           oldPoint = recep
  56.         end if
  57.         sendSprite(spr_loupe, #bouge)
  58.         sendSprite(spr_loupe, #repaint)
  59.         updateStage()
  60.       end repeat
  61.     end if
  62.   else
  63.     if gOutilActif = "zone" then
  64.       doBackUp()
  65.       if gFormeOutil = "line" then
  66.         angle = "NO"
  67.         sprite(spr_Buffer).member = member(gFormeOutil & "_" & angle)
  68.       else
  69.         sprite(spr_Buffer).member = member(gFormeOutil)
  70.       end if
  71.       a = the mouseH
  72.       b = the mouseV
  73.       repeat while the mouseDown
  74.         if gFormeOutil = "line" then
  75.           if the mouseH < a then
  76.             if the mouseV < b then
  77.               angle = "SO"
  78.             else
  79.               angle = "NO"
  80.             end if
  81.           else
  82.             if the mouseV < b then
  83.               angle = "SE"
  84.             else
  85.               angle = "NE"
  86.             end if
  87.           end if
  88.           sprite(spr_Buffer).member = member(gFormeOutil & "_" & angle)
  89.           updateStage()
  90.         end if
  91.         c = max(min(the mouseH, sprite(me.spriteNum).right), sprite(me.spriteNum).left)
  92.         d = max(min(the mouseV, sprite(me.spriteNum).bottom), sprite(me.spriteNum).top)
  93.         sprite(spr_Buffer).rect = rect(a, b, c, d)
  94.         updateStage()
  95.       end repeat
  96.       sprite(spr_Buffer).loc = point(-1000, -1000)
  97.       rectPreview = sendSprite(spr_loupe, #locrect)
  98.       rapport = float(rectPreview.width) / float(sprite(me.spriteNum).member.width)
  99.       a = rectPreview[1] + ((a - sprite(me.spriteNum).left) * rapport)
  100.       b = rectPreview[2] + ((b - sprite(me.spriteNum).top) * rapport)
  101.       c = rectPreview[1] + ((c - sprite(me.spriteNum).left) * rapport)
  102.       d = rectPreview[2] + ((d - sprite(me.spriteNum).top) * rapport)
  103.       recep = rect(a, b, c, d)
  104.       if gFormeOutil <> "line" then
  105.         recep = ordonne_rect(recep)
  106.       end if
  107.       repeat with i = 1 to 4
  108.         recep[i] = integer(recep[i])
  109.       end repeat
  110.       if gFormeOutil = "resize" then
  111.         img = image(member("pictSource").width, member("pictSource").height, 32)
  112.         img.copyPixels(member("pictSource").image, member("pictSource").rect, recep)
  113.         member("pictSource").image = img
  114.       else
  115.         if gRemplirZone then
  116.           member("pictSource").image.fill(recep, [#shapeType: symbol(gFormeOutil), #lineSize: 0, #color: gcouleurActive])
  117.         else
  118.           case gFormeOutil of
  119.             "rect":
  120.               member("pictSource").image.draw(rect(recep.left, recep.top, recep.right, recep.top), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
  121.               member("pictSource").image.draw(rect(recep.right, recep.top, recep.right, recep.bottom), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
  122.               member("pictSource").image.draw(rect(recep.left, recep.bottom, recep.right + 1, recep.bottom), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
  123.               member("pictSource").image.draw(rect(recep.left, recep.top, recep.left, recep.bottom), [#shapeType: #line, #lineSize: 1, #color: gcouleurActive])
  124.             otherwise:
  125.               member("pictSource").image.draw(recep, [#shapeType: symbol(gFormeOutil), #lineSize: 1, #color: gcouleurActive])
  126.           end case
  127.         end if
  128.       end if
  129.       sendSprite(spr_loupe, #bouge)
  130.       sendSprite(spr_loupe, #repaint)
  131.     end if
  132.   end if
  133. end
  134.  
  135. on mouseUp me
  136.   validReglage()
  137.   pass()
  138. end
  139.